<extend name="Public/base" />
<block name="body">
	<link href="__PUBLIC__/assets/plugins/ueditor/themes/default/css/umeditor.min.css" type="text/css" rel="stylesheet">
	<script type="text/javascript" charset="utf-8" src="__PUBLIC__/assets/plugins/ueditor/umeditor.config.js"></script>
	<script type="text/javascript">
	window.UMEDITOR_CONFIG.imageUrl = "{:U('editor_upload_pic')}" ;
	window.UMEDITOR_CONFIG.imagePath = "__ROOT__/Uploads/" ;  
	</script>
	<!-- BEGIN PAGE CONTENT-->
	<div class="row profile">
		<div class="col-md-12">
			<!--BEGIN TABS-->
			<form method="post" action="{:U('edit')}">
				<div class="tabbable tabbable-custom tabbable-full-width">
					<ul class="nav nav-tabs">
						<li class="active"><a href="#tab1" data-toggle="tab"> 基 础 </a></li>
						<li class=""><a href="#tab2" data-toggle="tab"> 扩 展 </a></li>
					</ul>
					<div class="tab-content">
						<div class="tab-pane active" id="tab1">
							<div class="tab-pane">
								<div class="form-group">
									<label class="control-label">文章标题</label>
									<input type="text" class="form-control input-large" name="title" value="{$info.title}" />
								</div>
								<div class="form-group">
									<label class="control-label">所属分类</label>
									<select class="form-control input-medium" name="category_id">
										<option value="">选择分类</option>
										<volist name="category" id="vo">
											<option value="{$vo.id}" <eq name="info.category_id" value="$vo.id">selected</eq> >{$vo.html}{$vo.title}</option>
										</volist>
									</select>
								</div>
								<div class="form-group">
									<label class="control-label">内容</label>
									<textarea id="content" name="content" class="form-control" style="width:100%;height:400px" />{$info.content}</textarea>
								</div>
								<div class="form-group">
									<label class="control-label">描述</label>
									<textarea name="description" class="form-control input-medium">{$info.description}</textarea>
								</div>
							</div>  
						</div>

						<div class="tab-pane" id="tab2">
							<div class="tab-pane">
								<div class="form-group" id="spic">
									<label  class="control-label">封面图片</label>
									<input type="file" id="pic" name="pic[]" multiple>
									<input type="hidden" name="cover" id="showpic" value="{$info.cover}">
								</div>
								<div class="upload-img-box">
									<if condition="$info.cover">
										<div class="upload-pre-item">
											<img src="__ROOT__/Uploads/{$info.cover}" alt="">
										</div>
									</if>
								</div>
								<div class="form-group">
									<label  class="control-label">可见性</label>
									<div class="radio-list">
										<label class="radio-inline">
											<input type="radio" value="0" name="display" checked="checked" > 可见
										</label>
										<label class="radio-inline">
											<input type="radio" value="1" name="display" <eq name="info.display" value="1">checked</eq>> 隐藏
										</label>
									</div>
								</div>
								<div class="form-group">
									<label class="control-label">推荐位</label>
									<div class="radio-list">
										<label class="checkbox">
											<input class="" type="checkbox" name="position[]" value="1">
											列表推荐
										</label>
										<label class="checkbox">
											<input class="" type="checkbox" name="position[]" value="2">
											频道推荐
										</label>
										<label class="checkbox">
											<input class="" type="checkbox" name="position[]" value="3">
											首页推荐
										</label>
									</div>
								</div>
								<div class="form-group">
									<label  class="control-label">排序</label>
									<input type="text" class="form-control input-small" name="sort" value="{$info.sort}">
								</div>
								<div class="form-group">
									<label class="control-label">浏览量</label>
									<input type="text" class="form-control input-small" name="view" value="{$info.view}" />
								</div>
								<div class="form-group">
									<label class="control-label">评论数</label>
									<input type="text" class="form-control input-small" name="comment" value="{$info.comment}" />
								</div>
								<div class="form-group">
									<label class="control-label">发布时间</label>
									<input type="text" name="create_time" readonly="" class="form-control input-medium form_date" value="{$info.create_time|date='Y-m-d',###}" />
								</div>
							</div>  
						</div>
                        
						<label class="control-label"></label>
						<input type="hidden" name="id" value="{:I('get.id')}">
						<div class="margin-top-10">
							<button type="button" class="btn green ajax-post">确 认</button>
							<a href="javascript:" onclick="javascript:history.back(-1);return false;" class="btn default">返 回</a>
						</div>
					</div> 
				</div>
			</form>
		</div>
	</div>
</block>
<block name="script">
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/assets/plugins/uploadify/uploadify.css">
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/assets/plugins/bootstrap-datetimepicker/css/datetimepicker.css" />
	<link href="__PUBLIC__/assets/plugins/uniform/css/uniform.default.css" rel="stylesheet" type="text/css"/>
	<script src="__PUBLIC__/assets/plugins/uniform/jquery.uniform.min.js" type="text/javascript" ></script>
	<script type="text/javascript" src="__PUBLIC__/assets/plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js"></script>
	<script type="text/javascript" src="__PUBLIC__/assets/plugins/bootstrap-datetimepicker.zh-CN.js"></script>
	<script type="text/javascript" charset="utf-8" src="__PUBLIC__/assets/plugins/ueditor/umeditor.min.js"></script>
	<script type="text/javascript" charset="utf-8" src="__PUBLIC__/assets/plugins/uploadify/jquery.uploadify.min.js"></script>

	<script type="text/javascript">
	$(function(){
		var ue = UM.getEditor('content');   

		$('.form_date').datetimepicker({
			format: 'yyyy-mm-dd hh:ii',
			language:  'zh-CN',
			autoclose: true,
			weekStart: 1,
			todayBtn:  1,
			todayHighlight: 1,
			startView: 2,
			minView: 1,
	      //forceParse: 0
	  });  
		var sid = "{:session_id()}";
		$('#pic').uploadify({
			'swf':'__PUBLIC__/assets/plugins/uploadify/uploadify.swf',
			'buttonText': '上传图片',
			'formData': { 'session_id':sid},
			'uploader': "{:U('uploadpic')}",
			'fileTypeDesc':'Image File',
			'fileTypeExts':'*.jpg; *.jpeg; *.gif; *.png',
			'onUploadSuccess':function(file,data,response){
				eval( ' var data = ' + data );
				if(data.status){
					$('#showpic').val(data.pic_path);
					$(".upload-img-box").html(
		        		'<div class="upload-pre-item"><img src="__ROOT__/Uploads/' + data.pic_path + '"/></div>'
		        	);
					toastr['success']('上传成功！');
				}else{
					toastr['error']('上传失败！');
				}
			}
		}); 

		highlight_subnav('{:U('index')}');
	})
	</script>
</block>